﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace eschoolBO
{
    public class gallery
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _gallery_id = -99;
        private long _album_id = -99;
        private string _image_name = "";
        private string _image_description = "";
        private bool _isdeleted = false;
        public long gallery_id
        {
            get
            {
                return _gallery_id;
            }
            set
            {
                _gallery_id = value;
            }
        }
        public long album_id
        {
            get
            {
                return _album_id;
            }
            set
            {
                _album_id = value;
            }
        }
        public string image_name
        {
            get
            {
                return _image_name;
            }
            set
            {
                _image_name = value;
            }
        }
        public string image_description
        {
            get
            {
                return _image_description;
            }
            set
            {
                _image_description = value;
            }
        }
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@gallery_id", gallery_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@album_id", album_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@image_name", image_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@image_description", image_description, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4 };
                return DAC.Save("gallery_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long gallery_id, long album_id, string image_name, string image_description, bool isdeleted, string paraandor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@gallery_id", gallery_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@album_id", album_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@image_name", image_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@image_description", image_description, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@paraandor", paraandor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5 };
                DataTable dt1 = DAC.Select("gallery_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }

    }
}